/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package yuhuibear.poat.object.convertor;

import java.math.BigDecimal;
import java.math.BigInteger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author yuhuibear
 */
public class ValueConvertorTest {

    public ValueConvertorTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of convert method, of class ValueConvertor.
     */
    @Test
    public void testConvert() throws Exception {
        System.out.println("convert");

        Object obj = new BigDecimal(3.3D);
        Object expResult = new Double(3.3);
        Object result = ValueConvertor.convert(obj);

        assertEquals(expResult, result);

        obj = new BigInteger(2 + "");
        expResult = new Long(2);
        result = ValueConvertor.convert(obj);

        assertEquals(expResult, result);

        obj = null;
        expResult = null;
        result = ValueConvertor.convert(obj);

        assertEquals(expResult, result);
    }

}